
#include <iostream>
#include <vector>
#define ll long long;
#define N 100010
#define endl '\n'
using namespace std;
int n;
int arr[N];
int dp[N];

void solve()
{
    cin>>n;
    for(int i = 1;i<=n;++i)
    {
        cin>>arr[i];
    }
    int ans = 0;
    for(int i = 1;i<=n;++i)
    {
        dp[i] = 1;
        for(int j = 1;j<i;++j)
        {
            if(arr[i]>arr[j])
            {
                dp[i] = max(dp[i],dp[j]+1);   
                ans = max(ans,dp[i]);
            }
        }
    }
    cout<<ans<<endl;
}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    solve();
    return 0;
}
